//
//  YYT_BaseTableViewCell.m
//  AudioVisualFeast
//
//  Created by 张琪 on 16/1/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "QL_BaseTableViewCell.h"
#import <UIImageView+WebCache.h>

@interface QL_BaseTableViewCell ()
@property (nonatomic, retain) UIImageView *backImageview;
@property (nonatomic, retain) UIImageView *smallImageview;
@property (nonatomic, retain) UILabel *title;
@property (nonatomic, retain) UILabel *name;
@property (nonatomic, retain) UILabel *times;
@end
@implementation QL_BaseTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
   self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor blackColor];
        self.backImageview = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.backImageview.backgroundColor = [UIColor blackColor];
        [self addSubview:self.backImageview];
        
        self.smallImageview = [[UIImageView alloc] initWithFrame:CGRectZero];
        _smallImageview.contentMode = UIViewContentModeScaleAspectFill;
        self.smallImageview.clipsToBounds = YES;

        [_backImageview addSubview:_smallImageview];

        
        self.title = [[UILabel alloc] initWithFrame:CGRectZero];
        [_backImageview addSubview:self.title];
        _title.font = [UIFont systemFontOfSize:11];
        _title.textColor = [UIColor whiteColor];
        
        self.name = [[UILabel alloc] initWithFrame:CGRectZero];
        [_backImageview addSubview:self.name];
        _name.textColor = [UIColor colorWithRed:30 / 255.0 green:195 / 255.0 blue:153 / 255.0 alpha:1.0];

        _name.font = [UIFont systemFontOfSize:11];
        
        self.times = [[UILabel alloc] initWithFrame:CGRectZero];
        [_backImageview addSubview:self.times];
        _times.font = [UIFont systemFontOfSize:11];
        _times.textColor = [UIColor whiteColor];
        
        
    }return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.backImageview.frame = self.bounds;
    self.smallImageview.frame = self.bounds;
    self.title.frame = CGRectMake(5, self.bounds.size.height - 45, self.smallImageview.frame.size.width, 11);
    self.name.frame = CGRectMake(5, self.bounds.size.height - 30, 180, 11);
    self.times.frame = CGRectMake(5, self.bounds.size.height - 15, 180, 11);
}

-(void)setModel:(QL_ModleShared *)model{
    
    _model = model;
    

    [_smallImageview sd_setImageWithURL:[NSURL URLWithString:_model.albumImg] placeholderImage:[UIImage imageNamed:@"zhanweitu.png"]];

    self.title.text = _model.title;
    self.times.text = [NSString stringWithFormat:@"播放次数：%@", _model.totalViews];
    self.name.text = _model.artistName;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
